package com.toe.commodity.webapi.mapper;

import com.toe.pojo.entity.commodity.CommodityGoods;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.toe.pojo.vo.commodity.CommodityGoodsVO;
import com.toe.pojo.vo.commodity.CommodityOrderGoodsVO;
import com.toe.pojo.vo.commodity.GoodsListDetailsVO;
import com.toe.pojo.vo.commodity.RecommendRandomVO;
import com.toe.pojo.vo.order.QueryGoodsAndSpecifications;
import com.toe.pojo.vo.recommend.RecommendCommodityVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 陶涛
 * @since 2022-07-19
 */
@Repository
public interface CommodityGoodsMapper extends BaseMapper<CommodityGoods> {
//商品的相关操作

    //添加新的在售商品
    Integer addNewCommodityGoods(CommodityGoods commodityGoods);

    //更新在售商品信息
    Integer updateCommodityGoods(CommodityGoods commodityGoods);

    //删除在售的商品
    Integer deletedCommodityGoods(Long id);

    //根据id列表查询商品
    List<RecommendCommodityVO> getCommodityGoodsById(List<Long> ids);

    CommodityOrderGoodsVO getOrderGoodsById(@Param("goodsId") Long goodsId, @Param("specificationId") Long specificationId);

    List<CommodityOrderGoodsVO> listOrderGoodsByIds(
            List<QueryGoodsAndSpecifications> ids);

    //根据课程类型id查询对应的课程信息
    List<GoodsListDetailsVO> getCommodityGoodsByGoodsTypeId(Long id);

    //根据商家id查询对应的课程信息
    List<GoodsListDetailsVO> getCommodityGoodsByBusinessId(Long id);

    //根据销量查询商品列表
    List<GoodsListDetailsVO> getCommodityGoodsBySales();

    //根据商品id查询商品
    CommodityGoodsVO getGoodsById(Long id);

    List<RecommendRandomVO> getRecommendRandom();
}
